package cn.edu.scau.cmi.chensixiao.javaFX;

import cn.edu.scau.cmi.chensixiao.adapter.AdapterOfClass;
import cn.edu.scau.cmi.chensixiao.adapter.AdapterOfObject;
import cn.edu.scau.cmi.chensixiao.adapter.Target;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;

public class AdapterController {
	@FXML
	private Label nameLabel;
	@FXML
	private Label idLabel;
	@FXML
	private ChoiceBox<String> typeOfAdapter;
	@FXML
	private Button button;
	@FXML
	private TextArea showText;
	

	public void initialize() {
		typeOfAdapter.getItems().addAll("Class Adapter","Object Adapter");
		
	}
	
	public void buttonOnClick() {
		Target target = null;
		String adapterType = typeOfAdapter.getValue();
		switch(adapterType) {
		case"Class Adapter": target = new AdapterOfClass();break;
		case"Object Adapter": target = new AdapterOfObject();break;
		}
		showText.appendText(target.getClass().getName()+"类："+target.ProvideTargetElectricity()+"V电压\n\n");
	}
	

}
